package com.matrix.im.infrastructure.persistence.repository;

import com.matrix.im.domain.model.ChatMessage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

/**
 * @author 有点甜
 * @since 2025/8/2
 */
@Repository
public interface ChatMessageMongoRepository extends MongoRepository<ChatMessage, String> {

    /**
     * 根据会话ID分页查询聊天记录
     *
     * @param conversationId 会话ID
     * @param pageable       分页信息
     * @return 分页的聊天记录
     */
    Page<ChatMessage> findByConversationId(String conversationId, Pageable pageable);
}
